import 'dart:convert';

import 'package:learning/generated/json/base/json_field.dart';
import 'package:learning/generated/json/question_entity.g.dart';

export 'package:learning/generated/json/question_entity.g.dart';

@JsonSerializable()
class QuestionEntity {
  late int total;
  late int branching;
  late List<QuestionList> list;

  QuestionEntity();

  factory QuestionEntity.fromJson(Map<String, dynamic> json) =>
      $QuestionEntityFromJson(json);

  Map<String, dynamic> toJson() => $QuestionEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class QuestionList {
  late int subject;
  late int languageId;
  late String optionC;
  late String optionD;
  late String remark;
  late String optionA;
  late int sort;
  late String optionB;
  late int type;
  late String content;
  late String tags;
  late int difficulty;
  late String answer;
  late int id;

  QuestionList();

  factory QuestionList.fromJson(Map<String, dynamic> json) =>
      $QuestionListFromJson(json);

  Map<String, dynamic> toJson() => $QuestionListToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
